﻿using System;
namespace Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="KarrMeta", Namespace="http://producers.etoimik.xtee.riik.ee/producer/etoimik", Target=typeof(KarrMeta))]
    public class KarrMetaSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IKarrMeta clazz;
        
        public KarrMetaSerializer(IKarrMeta clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            if (clazz.ParinguID!=null) {
                Writer.WriteStartElement("ParinguID");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "int");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdInt(((int)(clazz.ParinguID))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.AsjaLiikKL!=null) {
                Writer.WriteStartElement("AsjaLiikKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.AsjaLiikKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.ParinguEesmarkKL!=null) {
                Writer.WriteStartElement("ParinguEesmarkKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.ParinguEesmarkKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.PiiratudParing!=null) {
                Writer.WriteStartElement("PiiratudParing");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "boolean");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdBoolean(((bool)(clazz.PiiratudParing))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.OtsiArhiivist!=null) {
                Writer.WriteStartElement("OtsiArhiivist");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "boolean");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdBoolean(((bool)(clazz.OtsiArhiivist))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.OnTasuline!=null) {
                Writer.WriteStartElement("OnTasuline");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "boolean");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdBoolean(((bool)(clazz.OnTasuline))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.OnSalastatud!=null) {
                Writer.WriteStartElement("OnSalastatud");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "boolean");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdBoolean(((bool)(clazz.OnSalastatud))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Pohjendus!=null) {
                Writer.WriteStartElement("Pohjendus");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Pohjendus))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.AvalduseNR!=null) {
                Writer.WriteStartElement("AvalduseNR");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.AvalduseNR))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Infosysteem!=null) {
                Writer.WriteStartElement("Infosysteem");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Infosysteem))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.ValitudParinguTegemiseAeg!=null) {
                Writer.WriteStartElement("ValitudParinguTegemiseAeg");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.ValitudParinguTegemiseAeg))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.VahemikuAlgusKP!=null) {
                Writer.WriteStartElement("VahemikuAlgusKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.VahemikuAlgusKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.VahemikuLoppKP!=null) {
                Writer.WriteStartElement("VahemikuLoppKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.VahemikuLoppKP))).ToString());
                Writer.WriteEndElement();
            }
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="ParinguID") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.ParinguID = new global::Xtee.Core.Schema.XsdInt(Reader.ReadElementString("ParinguID")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="AsjaLiikKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.AsjaLiikKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("AsjaLiikKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="ParinguEesmarkKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.ParinguEesmarkKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("ParinguEesmarkKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="PiiratudParing") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.PiiratudParing = new global::Xtee.Core.Schema.XsdBoolean(Reader.ReadElementString("PiiratudParing")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="OtsiArhiivist") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.OtsiArhiivist = new global::Xtee.Core.Schema.XsdBoolean(Reader.ReadElementString("OtsiArhiivist")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="OnTasuline") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.OnTasuline = new global::Xtee.Core.Schema.XsdBoolean(Reader.ReadElementString("OnTasuline")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="OnSalastatud") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.OnSalastatud = new global::Xtee.Core.Schema.XsdBoolean(Reader.ReadElementString("OnSalastatud")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Pohjendus") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Pohjendus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Pohjendus")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="AvalduseNR") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.AvalduseNR = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("AvalduseNR")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Infosysteem") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Infosysteem = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Infosysteem")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="ValitudParinguTegemiseAeg") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.ValitudParinguTegemiseAeg = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("ValitudParinguTegemiseAeg")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="VahemikuAlgusKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.VahemikuAlgusKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("VahemikuAlgusKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="VahemikuLoppKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.VahemikuLoppKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("VahemikuLoppKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
        }
    }
}
